public class ExtraPriceTaxiCharge implements TaxiCharge {
    private final int fromDistance;
    private final double extraPrice;

    public ExtraPriceTaxiCharge(int fromDistance, double extraPrice) {
        this.fromDistance = fromDistance;
        this.extraPrice = extraPrice;
    }

    @Override
    public double chargeFor(int distance) {
        return distance > fromDistance ? (distance - fromDistance) * extraPrice : 0;
    }
}
